﻿function isNumberKeyOnly(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode

    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }

    return true;
}
function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode

    if (charCode == 46) {
        return true;
    }
    else if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }

    return true;
}

function clearText(ctrl,defaultText) {
    if(ctrl.value == defaultText)
    {
        ctrl.value = ""
        ctrl.style.color = "#000000";
    }
}

function resetText(ctrl,defaultText) {
    if(ctrl.value == "")
    {
        ctrl.value = defaultText
        ctrl.style.color = "#C0C0C0";
    }
}

function minmax(value, min, max) {
    if (parseInt(value) < min || isNaN(value))
        return min;
    else if (parseInt(value) > max)
        return max;
    else return value;
}

/* Scroll back to the top after update */
function SetScrollEvent() {
    window.scrollTo(0, 0);
}